<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>035-generator函数的基本使用.html</title>
</head>
<body>
	
</body>
<script type="text/javascript">
	// function * gen(){
	// 	console.log('start gen fn')
	// 	yield 'data1'

	// 	console.log('do something after get data1')
	// 	yield 'data2'
	// 	console.log('do something after get data2')
	// 	console.log('end gen fn')

	// 	return 'result data'
	// }


	// const g = gen()
	// console.log(g.next())
	// console.log(g.next())



	function * xxx(){
		console.log('start gen fn')
		yield 'xxx1'
		console.log('do something after get xxx1')
		yield 'xxx2'
		console.log('do something after get xxx2')
		console.log('end gen fn')
		return 'result xxx' 
	}
	const g = gen()
	console.log(g.next())
	console.log(g.next())
</script>
</html>